package com.yjk.controller;


import com.yjk.entity.Baoguang;
import com.yjk.entity.Huisheng;
import com.yjk.entity.News;
import com.yjk.service.IBaoguangService;
import com.yjk.service.IHuishengService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yjk
 * @since 2022-04-05
 */
@RestController
@RequestMapping("/huisheng")
public class HuishengController {
    @Autowired
    private IHuishengService hs;

    @GetMapping("/")
    public List<Huisheng> selectAll(){
        return hs.list();
    }
    @GetMapping("/selectId/{id}")
    public Huisheng selectAll(@PathVariable("id") int id){
        return hs.getById(id);
    }
    @DeleteMapping("/delete/{id}")
    public void deleteByid(@PathVariable("id") int id){
        hs.removeById(id);
    }
    @PostMapping("/add")
    public void add(@RequestBody Huisheng clazz){
        hs.updateById(clazz);
    }
    @PostMapping("/set")
    public void set(@RequestBody Huisheng clazz){
        hs.save(clazz);
    }
}

